const Base = require("../base.js");
const nodemailer = require("nodemailer")
const config={
    service:"QQ",
    auth:{
        user: "515235416@qq.com", // 使用的发送方邮箱
        pass: "mlyalpvvdufabhfj", // 使用的发送方邮箱授权码
    }
}
module.exports = class extends Base {
  async indexAction() {
     const transporter = nodemailer.createTransport(config)
    const mail = {
        from:"515235416@qq.com",
        subject: "测试主题", // 主题
        to:this.get("email")|| "chengguoqing@vision-medtech.com",
        html: `
        <html>
        <style> * { margin: 0; padding: 0; box-sizing: border-box; } .page-box { width: 884px; height: 580px; background: #FFFFFF; border: 5px solid #E6E6E6; padding: 20px } .df { display: flex } .flex1, .flex-1 { flex: 1 } .logo { width: 70px; height: 70px; } .ls { color: #0F8CD1 } .pl10 { padding-left: 10px } .fz30 { font-size: 30px } .fz16 { font-size: 16px } .logo-text { position: relative; top: -4px } .w100 { width: 100% } .jzhh { white-space: nowrap } .tr { text-align: right } .mt40 { margin-top: 30px } .jnseert { margin-top: 15px } .context { border: 2px dashed #C9C9C9; height: 240px; margin-top: 10px; } .jhbbkser { width: 200px; border-right: 2px dashed #C9C9C9; height: 100% } .user-icon { width: 94px; height: 140px } .mt10 { margin-top: 10px } .xiaziass { display: inline-block; width: 117px; height: 36px; color: #fff; text-align: center; color: #1088F8; line-height: 36px; } .vertical-center { display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -webkit-box-pack: center; -ms-flex-pack: center; justify-content: center; -webkit-box-orient: vertical; -webkit-box-direction: normal; -ms-flex-direction: column; flex-direction: column } .qrCode { width: 186px; height: 186px } .red { color: red }</style>
    
    
    <body>
        <div class="page-box">
            <div class="df">
                <div class="flex-1 df w100">
                    <img src="https://duxinggj.com/www/gjq/logo.png" class="logo">
                    <div class="pl10">
                        <p class="fz30 ls logo-text">赛尚网上照相馆</p>
                        <p class="fz16 ls">证件照数码回执</p>
                    </div>
                </div>
                <div class="jzhh tr">
                    QQ：3592449759
                    <p> 联系电话：18033442942</p>
                </div>
            </div>
    
            <p class="mt40">
                尊敬的<span class="ls">微信昵称</span>，您好！
            </p>
            <p class="jnseert">
                感谢您选择赛尚网上照相馆！您的订单：CZ1224566546666566 已于 2022-22-14 10:01:15处理完成。
                您可以微信扫描下方二维码查看订单详情。
            </p>
            <p class="mt40">
                下载电子照片/回执
            </p>
    
            <div class="context df">
                <div class="jhbbkser vertical-center">
                    <img src="https://duxinggj.com/www/gjq/111.png" class="user-icon">
                    <p class="mt10">
    
                        <a class="xiaziass" href="https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/img/loadleft.099dd847.png" download="111.png">下载图片</a>
                    </p>
                </div>
                <div class="jhbbkser vertical-center">
                    <img src="https://duxinggj.com/www/gjq/111.png" class="user-icon">
                    <p class="mt10">
                        <a class="xiaziass" href="https://duxinggj-1251133427.cos.ap-guangzhou.myqcloud.com/img/loadleft.099dd847.png" download="111.png">下载模版</a>
                    </p>
                </div>
                <div class="jhbbkser vertical-center">
                    <img src="https://duxinggj.com/www/gjq/111.png" class="user-icon">
                    <p class="mt10">
    
    
                        <a class="xiaziass" href="http://static.cninfo.com.cn/finalpage/2022-03-29/1212707824.PDF" download="111.pdf">下载回执</a>
                    </p>
                </div>
                <div class="flex-1 vertical-center">
                    <div>
                        <img src="https://duxinggj.com/www/gjq/qrCode.png" class="qrCode">
                        <p class="red">扫一扫 免费领取纸质版</p>
                    </div>
                </div>
            </div>
            <p class="red mt10">
                注意：服务器资料只保留一个月，请尽快保存到本地，超时未保存责任自负。
            </p>
        </div>
    
    
    </body>
    
    </html>
    
        `
    }
    transporter.sendMail(mail,function(error,info){
        console.log(error)
        console.log(info)
        if(error){
            return   this.success(error)
        }
        transporter.close()
    })

    this.success(mail)

  }
};
